package top.wlink.bzgrowup.bzex;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

/*
 * Created by 5185756@qq.com on 2017/6/5.
 */

public class Datex {
    public static SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA);
    public static SimpleDateFormat datetimeshort = new SimpleDateFormat("yy-MM-dd HH:mm:ss", Locale.CHINA);
    public static SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
    public static SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss", Locale.CHINA);
    public static Calendar getCalendar(){
        return Calendar.getInstance();
    }
    public static String now(){ return datetime.format(System.currentTimeMillis()); }

    // System.currentTimeMillis()  // 1天毫秒数：86400000
    public static Long getDayZeroTime(long aTime){ // System.currentTimeMillis()

        try{
            return date.parse(date.format(aTime)).getTime(); // 当天日期零点的数值
        }catch (ParseException e){
            e.printStackTrace();
            return null;
        }

    }
/*
    final Calendar lc_today = Calendar.getInstance(Locale.CHINA);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
    Log.i("MainActivityFilter", sdf.format(c.getTime()));
24小时制时间的方法c.get(Calendar.HOUR_OF_DAY)
if (c.get(Calendar.AM_PM) == Calendar.AM) {
    Log.i("MainActivityFilter", "现在是上午");
   12小时制时间 Log.i("MainActivityFilter", "现在是" + c.get(Calendar.HOUR) + "点");

   c.get(Calendar.DAY_OF_WEEK)) {  case Calendar.SUNDAY:  1 ~ 7 suterday
当前的月份为：" + (c.get(Calendar.MONTH) + 1));
在本月的第" + c.get(Calendar.DAY_OF_WEEK_IN_MONTH) + "周");

c.add(Calendar.DAY_OF_MONTH, 1);

 */

}
